<!doctype html>
<html>

<head>
  <!-- css文件 -->
  {include file="public/title" /}
</head>

<body data-type="generalComponents">
  <!-- 头部 -->
  {include file="public/header" /}
  <div class="tpl-page-container tpl-page-header-fixed">
    <!-- 左侧导航 -->
    {include file="public/leftNav" /}
    <div class="tpl-content-wrapper">
      <ol class="am-breadcrumb">
        <li><a href="#" class="am-icon-home">首页</a></li>
        <li><a href="#">支出管理</a></li>
        <li class="am-active">支出消费</li>
      </ol>
      <div class="tpl-portlet-components">
        <div class="tpl-block ">
          <div class="am-g tpl-amazeui-form">
            <div class="am-u-sm-12 am-u-md-9">
              <form class="am-form am-form-horizontal" id="form_ajax" onsubmit="return false">
                <div class="am-form-group">
                  <label for="user-mima" class="am-u-sm-3 am-form-label">编号 / id</label>
                  <div class="am-u-sm-9">
                      <input type="text" name="id" value="{$finance.id}" readonly/>
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-mima" class="am-u-sm-3 am-form-label">名称 / name</label>
                  <div class="am-u-sm-9">
                    <input type="text" name="name"  id="user-mima" value="{$finance.name}" readonly/>
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-mime" class="am-u-sm-3 am-form-label">消费 / balance</label>
                  <div class="am-u-sm-9">
                    <input type="text" name="balances" id="user-mime">
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-mime" class="am-u-sm-3 am-form-label">描述 / desc</label>
                  <div class="am-u-sm-9">
                    <textarea name="desc" rows="5" id="user-intro">{$finance.desc}</textarea>
                  </div>
                </div>
                <div class="am-form-group">
                  <div class="am-u-sm-9 am-u-sm-push-3">
                    <button type="submit" id="submitFrom" class="am-btn am-btn-primary">确定</button>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- js -->
  {include file="public/foot" /}
  <script>
    $('#submitFrom').click(function(){
      var formData = $('#form_ajax').serialize();
      $.ajax({
        url:"{:url('finance/spend')}",
        type:'POST',
        data:formData,
        success:function(data){
          if(data.code == 1){
            layer.alert(data.msg, {icon: 6});
          }else{
            layer.alert(data.msg, {icon: 5});
          }
        }
      })
    })
  </script>
</body>
</html>